using AutoMapper;
using Pay.DTO;
using Pay.Data;
using Pay.IService;

namespace Pay.Service.AutoMapper {
	public class ManageMapper : IStartupDto {
		private IMapperConfigurationExpression _cfg;
		public ManageMapper(IMapperConfigurationExpression cfg) {
			_cfg = cfg;
		}
		public void Execute() {
			Create();
		}
		protected virtual void Create() {
            _cfg.CreateMap<manage_dto, Manage>()
                .ForMember(dest => dest.Id, src => src.MapFrom(c => c.id))
                .ForMember(dest => dest.RoleId, src => src.MapFrom(c => c.role_id))
                .ForMember(dest => dest.MerchantId, src => src.MapFrom(c => c.merchant_id));

            _cfg.CreateMap<Manage, manage_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.role_id, src => src.MapFrom(c => c.RoleId))
                .ForMember(dest => dest.merchant_id, src => src.MapFrom(c => c.MerchantId));

        }
	}
}
